/* * *  OUTPUT A ZIP CODE. * * */
/* THIS ROUTINE FORMATS A ZIP CODE FOR DISPLAY. */
OUT_ZIP: PROC (ZIP) RETURNS(CHAR(10));
	DCL	ZIP CHAR(9);
	DCL	WRKZIP CHAR(14);

/* RETURN IF NULL ZIP. */
	WRKZIP=' ';
	IF ZIP=WRKZIP THEN	/* NULL INPUT */
	   RETURN(WRKZIP);

/* SET UP DEFAULT ZIP CODE (NINE DIGITS). */
	SUBSTR(WRKZIP,1,5)=SUBSTR(ZIP,1,5); /* GET PREFIX. */
	SUBSTR(WRKZIP,6,1)='-';
	SUBSTR(WRKZIP,7,4)=SUBSTR(ZIP,6,4); /* GET NUMBER. */

/* HANDLE CANADIAN LIKE ZIP CODE (SIX DIGITS). */
	IF SUBSTR(ZIP,7,3)=' ' &   	/* CHECK FOR 6 DIGIT CODE. */
	   SUBSTR(ZIP,6,1)~=' ' THEN
	   WRKZIP=ZIP;

/* HANDLE SHORT ZIP CODE (FIVE DIGITS). */
	IF SUBSTR(ZIP,6,4)=' ' THEN	/* CHECK FOR 5 DIGIT CODE. */
	   WRKZIP=ZIP;

/* RETURN TO CALLER. */
	RETURN(WRKZIP);
	END OUT_ZIP;

